

import 'package:FiduMart/core/network/model/base/base_model_entity.dart';
import 'package:FiduMart/generated/json/base/json_convert_content.dart';

BaseModelEntity<T> $BaseModelEntityFromJson<T>(Map<String, dynamic> json) {
  final BaseModelEntity<T> baseModelEntity = BaseModelEntity<T>();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    baseModelEntity.code = code;
  }
  final T? data = jsonConvert.convert<T>(json['data']);
  if (data != null) {
    baseModelEntity.data = data;
  }
  final String? message = jsonConvert.convert<String>(json['message']);
  if (message != null) {
    baseModelEntity.message = message;
  }
  return baseModelEntity;
}

Map<String, dynamic> $BaseModelEntityToJson(BaseModelEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['data'] = entity.data;
  data['message'] = entity.message;
  return data;
}

extension BaseModelEntityExt on BaseModelEntity {
  BaseModelEntity copyWith({
    int? code,
    dynamic data,
    String? message,
  }) {
    return BaseModelEntity()
      ..code = code ?? this.code
      ..data = data ?? this.data
      ..message = message ?? this.message;
  }
}